package com.yx.cloud.activity;

import android.content.Intent;
import android.view.View;

import com.iot.common.utils.LogUtils;
import com.iot.product.sweeper.config.SweeperProductConfig;
import com.iot.sweeper.AppContext;
import com.yx.cloud.R;
import com.yx.cloud.base.BaseActivity;
import com.yx.cloud.databinding.ProductguideActivityBinding;
import com.yx.cloud.product.ProductConfigConstants;
import com.yx.cloud.utils.Intent_utils;
import com.yx.cloud.utils.LanguageUtils;
import com.yx.cloud.utils.RomUtils;

import org.json.JSONObject;


/**
 * 创建时间 : 2018/12/26.
 * 创建人 :
 * 功能描述 :产品指南界面
 */
public class ProductGuideActivity extends BaseActivity implements View.OnClickListener {
    private String mLanguage;
    private Intent menuStyleImage;
    private ProductguideActivityBinding binding;

    @Override
    public void onCreate() {
        binding = ProductguideActivityBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());
        initData();
    }

    private void initData() {
        binding.ivProductGuideReturn.setOnClickListener(this);
        binding.llMenuStyleImage.setOnClickListener(this);
        binding.llUseMethod.setOnClickListener(this);
        binding.llEveryMaintain.setOnClickListener(this);
        binding.llTroubleRemoval.setOnClickListener(this);
        binding.llVoiceAssistant.setOnClickListener(this);

        JSONObject productConfig = AppContext.getConfig();
        if (!productConfig.optBoolean(ProductConfigConstants.voiceAssistant)) {
            binding.llVoiceAssistant.setVisibility(View.GONE);
        }

    }

    @Override
    protected void onStart() {
        super.onStart();
        //获取设置的语言 默认是中文
        mLanguage = LanguageUtils.getAndsetLanguage(this, "产品指南");
        LogUtils.i(" ： vvvvvvvvvvvvvvvvv " + mLanguage);

    }

    @Override
    public void onClick(View v) {
        if (RomUtils.isFastClick()) {
            return;
        }
        menuStyleImage = new Intent(this, RobotArchitectureActicity.class);
        menuStyleImage.putExtra("language", mLanguage);
        int id = v.getId();
        if (id == R.id.iv_productGuideReturn) {
            Intent_utils.backIntent(this);
        } else if (id == R.id.ll_menuStyleImage) {
            menuStyleImage.putExtra("tag", "1");
            startActivity(menuStyleImage);
        } else if (id == R.id.ll_useMethod) {
            menuStyleImage.putExtra("tag", "2");
            startActivity(menuStyleImage);
        } else if (id == R.id.ll_everyMaintain) {
            menuStyleImage.putExtra("tag", "3");
            startActivity(menuStyleImage);
        } else if (id == R.id.ll_troubleRemoval) {
            menuStyleImage.putExtra("tag", "4");
            startActivity(menuStyleImage);
        } else if (id == R.id.ll_voiceAssistant) {
            menuStyleImage.putExtra("tag", "5");
            startActivity(menuStyleImage);
        }
    }
}
